<?php


class TworldVoucherModel extends BaseModel
{
    protected $table = 'yf_tworld_voucher';

    protected $principal = 'id';

    public function getListByCardid(int $card_id)
    {
        $sql = "select v.id, i.title, i.price, i.category, i.vaild_type 
from {$this->table} as v 
left join yf_tworld_voucher_item as i on v.tworld_voucher_item_id = i.id 
where v.tworld_card_id = :tworld_card_id";
        return $this->db->query($sql, [
                ':tworld_card_id' => $card_id
            ])->fetchAll(PDO::FETCH_ASSOC) ?? [];
    }

}